package cn.mdmm.service.memcached;

import java.io.IOException;
import java.io.OutputStream;
import java.util.Collection;
import java.util.Map;
import java.util.concurrent.TimeUnit;

import org.springframework.remoting.service.annotation.RemoteService;


/** 
 * 类描述：Memcached服务<br>
 * <br/>
 * 创建人：邓强   <br>
 * 创建时间：2017年12月6日 上午9:30:11    <br> 
 * 修改人：  <br>
 * 修改时间：2017年12月6日 上午9:30:11   <br>  
 * 修改备注：     <br>
 * @version   V1.0      
 */
@RemoteService
public interface MemcachedService {
	public static int DEFAULT_TIMEOUT = 5;  
	  
    public static TimeUnit DEFAULT_TIMEUNIT = TimeUnit.SECONDS;

	// ---- Basic Operation Start ----//
	public boolean set(String key, Object value);
	
	public boolean set(String key, Object value, int expire);

	public Object get(String key);

	public Object asyncGet(String key);

	public boolean add(String key, Object value, int expire);

	public boolean replace(String key, Object value, int expire);

	public boolean delete(String key);

	public boolean flush();

	public Map<String, Object> getMulti(Collection<String> keys);

	public Map<String, Object> getMulti(String[] keys);

	public Map<String, Object> asyncGetMulti(Collection<String> keys);

	public Map<String, Object> asyncGetMulti(String keys[]);
	// ---- Basic Operation End ----//

	// ---- increment & decrement Start ----//
	public long increment(String key, int by, long defaultValue, int expire);

	public long increment(String key, int by);

	public long decrement(String key, int by, long defaultValue, int expire);

	public long decrement(String key, int by);

	public long asyncIncrement(String key, int by);

	public long asyncDecrement(String key, int by);
	// ---- increment & decrement End ----//

	public void printStats() throws IOException;

	public void printStats(OutputStream stream) throws IOException;
}
